package com.hc.controller;

import com.hc.service.*;
import com.hc.util.DateUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author LiuZhiHao
 * @date 2019/12/13 18:07
 * 描述:
 **/
@RestController
@RequestMapping("/test")
@Api(value = "测试定时器")
public class testController {

    @Autowired
    private TriplicitiesService triplicitiesService;

    @Autowired
    private QcEquipmentService qcEquipmentService;

    @GetMapping("/testSc")
    @ApiOperation("冰箱")
    public void inset(String time){
        triplicitiesService.insetRefrigeratormv(time);
    }

    @GetMapping("/testSc1")
    @ApiOperation("培养箱")
    public void inset1(String time){
        triplicitiesService.insetIIncubatormvLabSystem(time);
        qcEquipmentService.snapshotTest(time);
    }

    @GetMapping("/testSc2")
    @ApiOperation("培养室环境")
    public void inset2(String time){
        triplicitiesService.insetEnvironmentmvmv(time);
    }

    @GetMapping("/supplement_lab_data")
    @ApiOperation("补充一段时间内实验室设备运行数据,不包含起始时间")
    public void supplementLabData(String startTime,String endTime){
        List<String> betweenDates = DateUtil.getBetweenDates(startTime, endTime, true);
        betweenDates.forEach(date->{
            triplicitiesService.insetRefrigeratormv(date);
            triplicitiesService.insetIIncubatormvLabSystem(date);
            qcEquipmentService.snapshotTest(date);
            triplicitiesService.insetEnvironmentmvmv(date);
        });
    }


}
